package com.dogdog.manager;

import org.apache.http.impl.client.AbstractHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.HttpClientStack;
import com.android.volley.toolbox.Volley;
import com.dogdog.bean.Me;

import android.R;
import android.app.Application;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;

public class MyApplication extends Application {
    
	//一般请求队列
	public static RequestQueue queues;
	//专门用于轮询更新用户请求的队列，避免与其他请求队列堵塞
	public static RequestQueue userQueue;
	private static AbstractHttpClient mHttpClient;
    private static Me me;
	private static Bitmap unkuownBit;
	
	@Override
    public void onCreate() {  
    	super.onCreate();
    	mHttpClient = new DefaultHttpClient();  
    	//传入HttpClientStack，才能保证cookies与服务器交互，默认volley无cookies支持
   queues=Volley.newRequestQueue(getApplicationContext(),new HttpClientStack(mHttpClient));
   userQueue=Volley.newRequestQueue(getApplicationContext());
   unkuownBit=BitmapFactory.decodeResource(getApplicationContext().getResources(),Color.GRAY);
    }

    public static RequestQueue getHttpQueue(){
	    return queues;}
    
    //轮询专用队列
    public static RequestQueue getUserQueue(){
	    return userQueue;}
    
    //设置用户数据
    public static void setMeData(Me m){
    	me=m; }
    
    public static Me getMeData(){
    	return me;
    }
    
    //未能正确显示图片时，用该位图进行替换
    public static Bitmap getUnkowBit(){
    	return unkuownBit;  }
    
    
    

}